<?php
class Block_PopularNews extends Zend_Controller_Action_Helper_Abstract
{
    private $_view;
    
    public function __construct($view) {
        $this->_view = $view;
    }

    public function init() {
        $this->createPopularNewsBlock();
    }

    public function createPopularNewsBlock() {
        $contentModel = new Application_Model_Content();
        $popularNews = $contentModel->getPopularPosts();

        $layout = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('Layout');
        $layout->popularNews = $this->_view->partial(
            'popular_news.phtml',
            array(
                'posts' => $popularNews
            )
        );
    }

}